const { BrowserWindow, getCurrentWindow } = require("@electron/remote");

window.addEventListener("DOMContentLoaded", () => {
  const btn = document.querySelector("#btn");
  btn.addEventListener("click", () => {
    let subWin = new BrowserWindow({
       width: 300,
       height: 200,
       parent: getCurrentWindow(), // 指定父级 形成父子窗口
       modal: true // 是否为模态窗口
    });
    subWin.loadFile("./02-父子模态窗口/sub.html");
    subWin.on("close", () => subWin = null);
  });
});